<div id="page-wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header"><?php echo __('Setting email') ?></h1>
        </div>
        <?php
        echo $this->Form->create('Mail', array(
            'inputDefaults' => array(
                'wrapInput' => false,
                'class' => 'form-control',
                'method' => 'post'
            )
        ));
        ?> 
        <div class="col-lg-12">
            <div class="row">

                <?php
                echo $this->Form->input('Mail.email_contact', array(
                    'label' => __('Contact Email'),
                    'type' => 'text',
                    'div' => 'form-group',
                ));
                ?>
                <?php
                echo $this->Form->input('Mail.email_sender', array(
                    'label' => __('Sender'),
                    'type' => 'text',
                    'div' => 'form-group',
                ));
                ?>
                <?php
                echo $this->Form->input('Mail.email_method', array(
                    'label' => __('Select Method'),
                    'type' => 'select',
                    'options' => array('smtp' => 'Smtp', 'nosmtp' => 'noSmtp'),
                    'div' => 'form-group',
                    'id' => 'email_method'
                ));
                ?>
                <?php
                echo $this->Form->input('Mail.smtp_host', array(
                    'label' => __('Smpt host'),
                    'type' => 'text',
                    'div' => 'form-group smtp_class',
                ));
                ?>
                <?php
                echo $this->Form->input('Mail.smtp_port', array(
                    'label' => __('Smpt port'),
                    'type' => 'text',
                    'div' => 'form-group smtp_class',
                ));
                ?>
                <?php
                echo $this->Form->input('Mail.smtp_username', array(
                    'label' => __('Smpt username'),
                    'type' => 'text',
                    'div' => 'form-group smtp_class',
                ));
                ?>
                <?php
                echo $this->Form->input('Mail.smtp_password', array(
                    'label' => __('Smpt password'),
                    'type' => 'text',
                    'div' => 'form-group smtp_class',
                ));
                ?>

            </div>
            <div class="col-lg-12">
                <?php
                echo $this->Form->submit('Save', array(
                    'div' => 'form-group',
                    'class' => 'btn btn-danger'
                ));
                ?>
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
        <?php echo $this->Form->end(); ?>
    </div>
</div>
<!-- /#page-wrapper -->

<script>
    function checkSmtp(){
        if($("#email_method").val() == "smtp"){
            $(".smtp_class").show();
        }else{
            $(".smtp_class").hide();
        }
    }
    $(document).ready(function(){
        checkSmtp();
        $("#email_method").on('change',function(){
            checkSmtp();
        });
    });
</script>